home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tcl8.0 / tests / unknown.test < prev    next >
Encoding:
Text File  |  1997-08-15  |  1.7 KB  |  62 lines  |  [TEXT/ALFA]

  1. # Commands covered:  unknown
  2. #
  3. # This file contains a collection of tests for one or more of the Tcl
  4. # built-in commands.  Sourcing this file into Tcl runs the tests and
  5. # generates output for errors.  No output means no errors were found.
  6. #
  7. # Copyright (c) 1991-1993 The Regents of the University of California.
  8. # Copyright (c) 1994 Sun Microsystems, Inc.
  9. #
  10. # See the file "license.terms" for information on usage and redistribution
  11. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12. #
  13. # SCCS: @(#) unknown.test 1.12 96/08/26 11:29:29
  14.  
  15. if {[string compare test [info procs test]] == 1} then {source defs}
  16.  
  17. catch {unset x}
  18. catch {rename unknown unknown.old}
  19.  
  20. test unknown-1.1 {non-existent "unknown" command} {
  21.     list [catch {_non-existent_ foo bar} msg] $msg
  22. } {1 {invalid command name "_non-existent_"}}
  23.  
  24. proc unknown {args} {
  25.     global x
  26.     set x $args
  27. }
  28.  
  29. test unknown-2.1 {calling "unknown" command} {
  30.     foobar x y z
  31.     set x
  32. } {foobar x y z}
  33. test unknown-2.2 {calling "unknown" command with lots of args} {
  34.     foobar 1 2 3 4 5 6 7
  35.     set x
  36. } {foobar 1 2 3 4 5 6 7}
  37. test unknown-2.3 {calling "unknown" command with lots of args} {
  38.     foobar 1 2 3 4 5 6 7 8
  39.     set x
  40. } {foobar 1 2 3 4 5 6 7 8}
  41. test unknown-2.4 {calling "unknown" command with lots of args} {
  42.     foobar 1 2 3 4 5 6 7 8 9
  43.     set x
  44. } {foobar 1 2 3 4 5 6 7 8 9}
  45.  
  46. test unknown-3.1 {argument quoting in calls to "unknown"} {
  47.     foobar \{ \} a\{b \; "\\" \$a a\[b \]
  48.     set x
  49. } "foobar \\{ \\} a\\{b {;} \\\\ {\$a} {a\[b} \\]"
  50.  
  51. proc unknown args {
  52.     error "unknown failed"
  53. }
  54.  
  55. test unknown-4.1 {errors in "unknown" procedure} {
  56.     list [catch {non-existent a b} msg] $msg $errorCode
  57. } {1 {unknown failed} NONE}
  58.  
  59. catch {rename unknown {}}
  60. catch {rename unknown.old unknown}
  61. return {}
  62.